package com.tuyrt.demo.singleton

/**
 * author: Administrator on 2021/11/10.
 * desc:
 */
class Singleton2 private constructor() {

    companion object {
        private var instance: Singleton2? = null
            get() {
                if (field == null) {
                    field = Singleton2()
                }
                return field
            }

        @Synchronized
        fun get(): Singleton2 {
            return instance!!
        }
    }
}